package com.api.request.model;

import java.util.HashMap;
import java.util.Map;

import com.api.client.model.ApiServiceMetadata;

public class RequestParameters {

	private final ApiServiceMetadata metadata;

	private Map<String, String> headers = new HashMap<String, String>();
	private Map<String, Object> pathParams = new HashMap<String, Object>();
	private Map<String, Object> queryParams = new HashMap<String, Object>();
	private Map<String, Object> formParams = new HashMap<String, Object>();

	private String accessKey;
	private String accessSecret;

	public RequestParameters(ApiServiceMetadata metadata) {
		if (metadata == null) {
			throw new IllegalArgumentException("Service metadata cannot be null");
		}
		this.metadata = metadata;
	}

	public ApiServiceMetadata getMetadata() {
		return metadata;
	}

	public String getAccessKey() {
		return accessKey;
	}

	public void setAccessKey(String accessKey) {
		this.accessKey = accessKey;
	}

	public String getAccessSecret() {
		return accessSecret;
	}

	public void setAccessSecret(String accessSecret) {
		this.accessSecret = accessSecret;
	}

	public Map<String, String> getHeaders() {
		return headers;
	}

	public Map<String, Object> getPathParams() {
		return pathParams;
	}

	public Map<String, Object> getQueryParams() {
		return queryParams;
	}

	public Map<String, Object> getFormParams() {
		return formParams;
	}

	public void addPathParam(String name, Object value) {
		this.pathParams.put(name, value);
	}

	public void addPathParams(Map<String, Object> params) {
		this.pathParams.putAll(params);
	}

	public void addQueryParam(String name, Object value) {
		this.queryParams.put(name, value);
	}

	public void addQueryParams(Map<String, Object> params) {
		this.queryParams.putAll(params);
	}

	public void addFormParam(String name, Object value) {
		this.formParams.put(name, value);
	}

	public void addFormParams(Map<String, Object> params) {
		this.formParams.putAll(params);
	}

	public void addHeaderParam(String name, String value) {
		this.headers.put(name, value);
	}

	public void addHeaderParams(Map<String, String> headers) {
		this.headers.putAll(headers);
	}
}
